<?php

class tplActivityList extends StudyBuddy\Template\Template
{
	protected static function func(&$a) {
                $oRegistry = \StudyBuddy\Registry::getInstance();
                
		$temp = $oRegistry->Mongo->BADGES->findOne(array('id' => $a['act_id']));
                
		$a['badges'] = $temp['b_name'];
                
		if($a['act_type'] == 'badges'){
			$a['act_link'] ='/badges/'.$a['act_id'].'/';     
		}else{
			$a['act_link'] = '/q'.$a['act_id'].'/';
			$a['act_name'] = str_replace('question', '', $a['act_name']);

			if (!empty($a['hts'])) {
				$a['hts_ago'] = \StudyBuddy\TimeAgo::format(new \DateTime($a['hts']));
			}	
			$a['badges'] = 'question';
		}

	}
	
	
	protected static $vars = array(
		'_id' => '0', //1
		'i_uid' => '0', //2
		'username' => '', //3
		'avt' => '/images/avatar.png', //4
		'act_type' => '0', //5
		'act_id' => '', //6
		'act_name' => '', //7
		'act_link' => '', //8
		'badges' => '', //9
	);

	protected static $tpl = '<li>
	                            <div class="recent-img">
                                    <a href="/users/%2$s/%3$s"><img alt="" src="%4$s" width="31px"/></a>
                                </div>
	                            <div class="recent-ct">
	                                <a href="/users/%2$s/%3$s"><span>%3$s</span></a>&nbsp;%7$s <a href="%8$s" style="float:none;"><span>%9$s</span></a>
	                            </div>
	                        </li>';
}